package com.qingsong.entity.table;

import com.mybatisflex.core.query.QueryColumn;
import com.mybatisflex.core.table.TableDef;


/**
 * 课程表 表定义层。
 *
 * @author qingsong
 * @since 2024-12-22
 */
public class CourseTableDef extends TableDef {

    private static final long serialVersionUID = 1L;

    /**
     *
     */
    public static final CourseTableDef COURSE = new CourseTableDef();


    public final QueryColumn ID = new QueryColumn(this, "id");


    public final QueryColumn IDX = new QueryColumn(this, "idx");


    public final QueryColumn INFO = new QueryColumn(this, "info");


    public final QueryColumn COVER = new QueryColumn(this, "cover");


    public final QueryColumn PRICE = new QueryColumn(this, "price");


    public final QueryColumn TITLE = new QueryColumn(this, "title");


    public final QueryColumn AUTHOR = new QueryColumn(this, "author");


    public final QueryColumn CREATED = new QueryColumn(this, "created");


    public final QueryColumn DELETED = new QueryColumn(this, "deleted");


    public final QueryColumn SUMMARY = new QueryColumn(this, "summary");


    public final QueryColumn UPDATED = new QueryColumn(this, "updated");


    public final QueryColumn VERSION = new QueryColumn(this, "version");


    public final QueryColumn FK_CATEGORY_ID = new QueryColumn(this, "fk_category_id");

    /**
     * 所有字段。
     */
    public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");

    /**
     * 默认字段，不包含逻辑删除或者 large 等字段。
     */
    public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, TITLE, AUTHOR, FK_CATEGORY_ID, SUMMARY, COVER, PRICE, IDX, INFO, VERSION, CREATED, UPDATED};

    public CourseTableDef() {
        super("ml_cms", "course");
    }

    private CourseTableDef(String schema, String name, String alisa) {
        super(schema, name, alisa);
    }

    public CourseTableDef as(String alias) {
        String key = getNameWithSchema() + "." + alias;
        return getCache(key, k -> new CourseTableDef("ml_cms", "course", alias));
    }

}
